{template 'common/header'}
<ul class="nav nav-tabs">
	<li><a href="./index.php?c=platform&a=reply&do=post&m={php echo $this->modulename}">新建活动</a></li>
    <li {if $op == 'list'} class="active" {/if}><a href="{php echo $this->createWebUrl('manage',array('op' =>'list'))}">活动列表</a></li>
    {if $op == 'award'}<li class="active" ><a>中奖信息</a></li>{/if}
    {if $op == 'player'}<li class="active" ><a>参与者信息</a></li>{/if}
    {if $op == 'friend'}<li class="active" ><a>助力者信息</a></li>{/if}
</ul>
<style>
th{
	text-align: center !important;
}

td{
	text-align: center !important;
	white-space: normal !important;
	word-break: break-all !important;
}
</style>
{if $op == 'list'}
<div class="main" style="background: white;">
    <div style="padding:15px;">
        <table class="table table-hover">
            <thead class="navbar-inner">
                <tr>
                    <th>规则名称</th>					
                    <th>活动名称</th>
                    <th style="width: 25%;">活动时间</th>
                    <th>成功条件</th>
                    <th>奖品名称</th>
                    <th style="width: 120px;">操作</th>
                </tr>
            </thead>
            <tbody>
                {loop $list $l}
                <tr>
                    <td><a href="./index.php?c=platform&a=reply&do=post&m={php echo $this->modulename}&rid={$l['rid']}">{$l['name']}</a></td>
                    <td><a href="./index.php?c=platform&a=reply&do=post&m={php echo $this->modulename}&rid={$l['rid']}">{$l['stitle']}</a></td>
                    <td>开始时间：{php echo date('Y-m-d H:i:s',$l['starttime'])}<br>结束时间：{php echo date('Y-m-d H:i:s',$l['endtime'])}</td>
                    <td>集 {$l['birds_success']} 喜鹊</td>
                    <td>{$l['title']}</td>
                    <td>
                    	<a style="margin-bottom: 5px;" href='{php echo $this->createWebUrl("manage",array("op"=>"award","rid"=>$l["rid"]))}' class="btn btn-info btn-sm">中奖({$l['award']})</a>
                    	<br>
                    	<a href='{php echo $this->createWebUrl("manage",array("op"=>"player","rid"=>$l["rid"]))}' class="btn btn-warning btn-sm">参与({$l['attend']})</a>
                    </td>
                </tr>
                {/loop}
            </tbody>
        </table>
    </div>
</div>
{elseif $op == 'award'}
<div class="main" style="background: white;">
    <div style="padding:15px;">
        <table class="table table-hover">
            <thead class="navbar-inner">
                <tr>
                    <th>参与者</th>
                    {if $rule['ismobile']}<th>手机号码</th>{/if}
                    {if $rule['isqq']}<th>QQ</th>{/if}
                    {if $rule['isemail']}<th>邮箱</th>{/if}
                    {if $rule['isaddress']}<th>地址</th>{/if}
                    <th>喜鹊数</th>
                    <th>状态</th>
                    <th>成功时间</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                {loop $list $l}
                <tr>
                    <td><img src="{$l['avatar']}" style="width: 50px;height: 50px;"><br>{if $l['realname']}{$l['realname']}{else}{$l['nickname']}{/if}</td>
                    {if $rule['ismobile']}<td>{$l['mobile']}</td>{/if}
                    {if $rule['isqq']}<td>{$l['qq']}</td>{/if}
                    {if $rule['isemail']}<td>{$l['email']}</td>{/if}
                    {if $rule['isaddress']}<td>{$l['address']}</td>{/if}
                     <td>{if empty($l['bnum'])}0{else}{$l['bnum']}{/if}</td>
                    <td>{if $l['status']==1}<label class="label label-success">搭桥成功</label>{else if $l['status']==2}<label class="label label-danger">已领奖</label>{/if}</td>
                    <td>{php echo date('Y-m-d H:i:s',$l['successtime'])}</td>
                    <td>
                    	{if $l['status']==1}<a href='{php echo $this->createWebUrl("manage",array("op"=>"take","pid"=>$l["id"],"rid"=>$rid))}' onclick="return confirm('操作后数据将不可恢复，确定发奖吗？')" class="btn btn-default btn-sm">发奖</a>{/if}
                    	<a href='{php echo $this->createWebUrl("manage",array("op"=>"friend","pid"=>$l["id"]))}' class="btn btn-default btn-sm">助力者</a>
                    </td>
                </tr>
                {/loop}
            </tbody>
        </table>
        {$pager}
    </div>
</div>
{elseif $op == 'player'}
<div class="main" style="background: white;">
    <div style="padding:15px;">
        <table class="table table-hover">
            <thead class="navbar-inner">
                <tr>
                    <th>参与者</th>
                    {if $rule['ismobile']}<th>手机号码</th>{/if}
                    {if $rule['isqq']}<th>QQ</th>{/if}
                    {if $rule['isemail']}<th>邮箱</th>{/if}
                    {if $rule['address']}<th>地址</th>{/if}
                    <th>喜鹊数</th>
                    <th>状态</th>
                    <th>参与时间</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                {loop $list $l}
                <tr>
                    <td><img src="{$l['avatar']}" style="width: 50px;height: 50px;"><br>{if $l['realname']}{$l['realname']}{else}{$l['nickname']}{/if}</td>
                    {if $rule['ismobile']}<td>{$l['mobile']}</td>{/if}
                    {if $rule['isqq']}<td>{$l['qq']}</td>{/if}
                    {if $rule['isemail']}<td>{$l['email']}</td>{/if}
                    {if $rule['address']}<td>{$l['address']}</td>{/if}
                    <td>{if empty($l['bnum'])}0{else}{$l['bnum']}{/if}</td>
                    <td>{if $l['status']==1}<label class="label label-success">搭桥成功</label>{else if $l['status']==2}<label class="label label-danger">已领奖</label>{else if $l['status']==0}未成功{/if}</td>
                    <td>{php echo date('Y-m-d H:i:s',$l['createtime'])}</td>
                    <td>
                    <a href='{php echo $this->createWebUrl("manage",array("op"=>"friend","pid"=>$l["id"]))}' class="btn btn-default btn-sm">助力者</a>
                    </td>
                </tr>
                {/loop}
            </tbody>
        </table>
        {$pager}
    </div>
</div>
{elseif $op == 'friend'}
<div class="main" style="background: white;">
    <div style="padding:15px;">
        <table class="table table-hover">
            <thead class="navbar-inner">
                <tr>
                    <th>姓名</th>		
                    <th>头像</th>
                    <th>喜鹊数</th>
                    <th>助力时间</th>
                </tr>
            </thead>
            <tbody>
                {loop $list $l}
                <tr>
                    <td>{$l['nickname']}</td>
                    <td><img src="{$l['avatar']}" style="width: 50px;height: 50px;"></td>
                    <td>{$l['birds_num']}</td>
                    <td>{php echo date('Y-m-d H:i:s',$l['createtime'])}</td>
                </tr>
                {/loop}
            </tbody>
        </table>
        {$pager}
    </div>
</div>
{/if}
{template 'common/footer'}